
var mysql = require('mysql');
var connection = mysql.createConnection({
    host: '127.0.0.1',
    user: 'root',
    password: 'root',
    database: 'alibaixiu'

})
model = {
    login
}

function login(data, callback) {

    var sql = `select * from users where email = "${data}"`;
    connection.query(sql, (err, reslut) => {
        if (err) {
            callback(err)
        } else {
            callback(null, reslut[0])
        }
    })
}


module.exports = model;